package com.pathpad.dao;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.pathpad.hibernate.PPUser;
import com.pathpad.hibernate.PPUserCommonPad;
import com.pathpad.hibernate.SRWebsites;

@SuppressWarnings("unchecked")
public class WebappDao extends HibernateDaoSupport {
	public <T> List<T> findNotSendTargetEntity(Class<T> clazz, String userId) {
		return getHibernateTemplate().find(
				" FROM " + clazz.getSimpleName() + " WHERE userId = '" + userId
						+ "'");
	}

	public void savePPUserTableVaule(PPUser ppUser) {
		getHibernateTemplate().save(ppUser);
	}

	public void savePPUserCommonPadTableVaule(PPUserCommonPad ppUserCommonPad) {
		getHibernateTemplate().save(ppUserCommonPad);
	}

	public List<PPUserCommonPad> findPPUserCommonPad(String userId) {
		String hsql = "From PPUserCommonPad t where t.ppUser.userId = '"
				+ userId + "'";
		return getHibernateTemplate().find(hsql);
	}
	
	public List<SRWebsites> findSRWebsites(){
		String hsql = " From SRWebsites";
		return getHibernateTemplate().find(hsql);
	}
}
